Delphi 生成二维码【PaintBox】并保存为本地文件添加至【Image】控件中 | 您所在的位置:网站首页 › cerulean box二维码生成怎么用 › Delphi 生成二维码【PaintBox】并保存为本地文件添加至【Image】控件中 |
RAD Studio 10.3 测试√ 需要控件:scEdit、scGPButton、Image、PaintBox 窗体的 OnCreate事件 和 OnDestroy事件: procedure TForm1.FormCreate(Sender: TObject); // 窗体创建 begin QRCodeBitmap := TBitmap.Create; // 代码图位 Update; end; procedure TForm1.FormDestroy(Sender: TObject); // 窗体销毁 begin QRCodeBitmap.Free; end;PaintBox的 OnPaint事件: procedure TForm1.PaintBox1Paint(Sender: TObject); var Scale: Double; begin PaintBox1.Canvas.Brush.Color := clRed; // 背景颜色 PaintBox1.Canvas.FillRect(Rect(0, 0, PaintBox1.Height, PaintBox1.Width)); // 填充矩形 if ((PaintBox1.Width > 0) and (PaintBox1.Height > 0)) then begin if PaintBox1.Width |
CopyRight 2018-2019 实验室设备网 版权所有 |